$(function() {
	$("#regis").click(
			function() {
				var name = $("#name").val();
				var pass = $("#pass").val();
				var stunum = $("#stunum").val();
				var mail = $("#mail").val();
				var phone = $("#phone").val();
				var mac = $("#mac").val();
				if(name =="姓名"||pass=="密码"||stunum == "学号"||mail=="邮箱"||phone == "手机号"||mac=="MAC地址"){
					name="";
					pass="";
					stunum="";
					mail="";
					mac="";
					phone="";
				}
				if (name.replace(/(^s*)|(s*$)/g, "").length == 0
						|| pass.replace(/(^s*)|(s*$)/g, "").length == 0
						|| mail.replace(/(^s*)|(s*$)/g, "").length == 0
						|| stunum.replace(/(^s*)|(s*$)/g, "").length == 0
						|| phone.replace(/(^s*)|(s*$)/g, "").length == 0
						|| mac.replace(/(^s*)|(s*$)/g, "").length == 0) {
					alert('不能为空');
					return false;
				}
				getDataFrom(name, pass,stunum,mail,mac,phone);
				return false;
			})
});
function getDataFrom(name, pass,stunum,mail,mac,phone){
	$.get("/register/register", {
		"name":name,
		"stunum":stunum,
		"pass":pass,
		"mail":mail,
		"phone":phone,
		"mac":mac
	}, function(data) {
		if(data == "恭喜大佬，注册成功了"){
			alert("恭喜大佬，注册成功了");
		}else if(data == "你是不是注册过了，反正你的学号已经被鬼注册了"){
			alert("你是不是注册过了，反正你的学号已经被鬼注册了");
		}else if(data == "该Mac已经被注册，如非本人操作请联系导生大大"){
			alert("该Mac已经被注册，如非本人操作请联系导生大大");
		}else{
			alert(data);
		}
		
	});
}